package com.study.customer.controller;

import com.study.customer.controller.clients.ChatClient;
import com.study.customer.controller.dto.ChatDto;
import com.study.customer.pojo.GameGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;

/**
 * chat服务开放chat-api
 * 功能介绍：浏览当前商品的ai介绍，与ai自由聊天
 * @author peng
 */
@RestController
@RequestMapping("/chat")
public class ChatController {
    @Autowired
    private ChatClient chatClient;
    /**
     * AI介绍文案生成
     *
     * @param gameGoods
     * @return
     */
    @PostMapping("/description")
    public String descriptionGame(@RequestBody GameGoods gameGoods) {
        String gameName = gameGoods.getGameName();
        String msg = "点评一下" + gameName + "这款游戏。";
        ChatDto chatDto = new ChatDto();
        chatDto.setMsg(msg);
        return chatClient.Chat(chatDto);
    }

    /**
     * 专家talk
     *
     * @param chatDto
     * @return
     */
    @PostMapping
    public String freeChat(@RequestBody ChatDto chatDto) {
        return chatClient.Chat(chatDto);
    }
}
